<?php
/*
	*发送邮件
*/
if(!defined('IN_PHPOE')) {
	exit('Access Denied');
}

class Mod_Sendmail{
	private static $obj = NULL;
	private static $tpl = NUll;
	private static $urlpath = NULL;	
	public static function sendmail($name,$content){
		require_once CHENCY_ROOT.'./source/module/email.class.php';
		self::$obj = $GLOBALS['db'];
		if(!empty($content)){
			$sql = "select * from ".DB_PREFIX."mailsetting where smtpid=1";
			$mailmes = self::$obj->fetch_first($sql);
			$smtpserver = $mailmes['smtpserver'];//SMTP服务器
			$smtpserverport = $mailmes['smtpserverport'];//SMTP服务器端口
			$smtpusermail = $mailmes['smtpusermail'];//SMTP服务器的用户邮箱
			$smtpemailto = $mailmes['smtpemailto'];//发送给谁
			$smtpuser = $mailmes['smtpuser'];//SMTP服务器的用户帐号
			$smtppass = $mailmes['smtppass'];//SMTP服务器的用户密码
			$mailsubject = $name."--留言";//邮件主题
			$mailbody = $content;//邮件内容
			$mailtype = "HTML";//邮件格式（HTML/TXT）,TXT为文本邮件
			$smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass);//这里面的一个true是表示使用身份验证,否则不使用身份验证.
			$smtp->debug = FALSE;//是否显示发送的调试信息
			$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype);	
			return true;
		}else{
			return false;
		}
		
	}
	
}
?>